# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=termcap
pkgver=1.3.1
pkgrel=1
pkgdesc='Enables programs to use display computer terminals in a device-independent manner.'
arch=('x86_64' 'aarch64')
url='http://www.catb.org/~esr/terminfo/'
license=('GPL')
source=("http://ftp.gnu.org/gnu/termcap/$pkgname-$pkgver.tar.gz")
sha512sums=('2bc2829af05a942e6041e9f2de7c9c50e466cd525f056c58c4f664b0e39012d901276737b7c2576450613694f16ae6b195e22913d8835aa345b5d88faddb0b69')

build() {
  cd "$pkgname-$pkgver"

  #make
  gcc -fPIC -c termcap.c -o termcap.o -DHAVE_STRING_H=1 \
    -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1
  gcc -shared -Wl,-soname,"libtermcap.so" \
    -o "$srcdir/libtermcap.so.$pkgver" "termcap.o"
}

package() {
  cd "$pkgname-$pkgver"

  install -Dm 755 "$srcdir/libtermcap.so.$pkgver" \
    "$pkgdir/usr/lib/libtermcap.so.$pkgver"

  for infofile in termcap.info*
  do
    install -Dm 644 "$srcdir/$pkgname-$pkgver/$infofile" \
      "$pkgdir/usr/share/info/$infofile"
  done
}

